# script 'BackupSite.ps1'

Write-Host 
# define variables for script
$SiteUrl = "http://win-scjail07sml:81/"
$BackupPath = "C:\Projets\Multitude\Save\"

# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) {
	Write-Host "Loading SharePoint Powershell Snapin"
	Add-PSSnapin "Microsoft.SharePoint.Powershell"
}

$date = $(Get-Date -UFormat "%Y%m%d")
$filename = 'multitude_' + $date + '.bak'
$filePath = $BackupPath + $filename


# Backup SPSite
Write-Host 
Write-Host "Saving Site :"  -foregroundcolor Magenta
Write-Host "- Identity 		 = " $SiteUrl -foregroundcolor Magenta
Write-Host "- Path 			 = " $filePath -foregroundcolor Magenta
Backup-SPSite -Identity $SiteUrl -Path $filePath
